﻿<?php
require_once('../../config.php');
global $DB;

/* Ket noi den file javascript - module.js */
$PAGE->requires->js_init_call('M.local_myplugin');	
$cssdir =  $CFG->wwwroot.'/local/myplugin/mycss.css';
echo '<link rel="stylesheet" href="colorbox.css" />';

echo '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>';

echo '<script src="/colorbox/colorbox/jquery.colorbox.js"></script>';

echo '<link rel="stylesheet" href="'.$cssdir.'" type="text/css" media="screen" />';

/* Chuan bi trang web can hien thi */	
$url = new moodle_url($CFG->wwwroot.'local/myplugin/CDIOCurriculum.php');
$PAGE->set_url($url);
$PAGE->set_title('CDIO-based curriculum');
$PAGE->set_heading('Cấu trúc chương trình đào tạo theo CDIO');
$PAGE->set_pagelayout('standard');

//Them thanh menu ngang ung voi trang trong duong link
navigation_node::override_active_url(new moodle_url($CFG->wwwroot.'/local/myplugin/cdiocurriculum.php', array('param'=>'value')));

echo $OUTPUT->header();

/* Viet doan code cua ban o day */
//lay danh sach khoi kien thuc tu database
$rs =$DB->get_records('body_of_knowledge');

//Hien thi danh sach khoi kien thuc len man hinh
echo html_writer::start_tag('form');
echo html_writer::start_tag('table', array('border'=>'1'));
echo html_writer::tag('th','Khối kiến thức',  array('style'=>'border: 1px solid black;'));
echo html_writer::tag('th','Số tín chỉ',  array('style'=>'border: 1px solid black;'));
echo html_writer::tag('th','Ghi chú',  array('style'=>'border: 1px solid black;'));

foreach($rs as $record) {
	$str = '\''.$record->bok_name.'\'';
	echo html_writer::start_tag('tr', array('border'=>'1', 'class'=>'block')); //block: khoi kien thuc
	echo html_writer::tag('td', $record->bok_name, array('id'=>$record->bok_name, 'style'=>'border: 1px solid black;','onclick'=>'showSubjectByBodyOfKnowledge(this.id)'));
	echo html_writer::end_tag('a');
	echo html_writer::tag('td', $record->bok_credit, array('style'=>'border: 1px solid black;'));
	// echo html_writer::tag('td', $str, array('style'=>'border: 1px solid black;'));
	
	echo html_writer::end_tag('tr');
}
echo html_writer::end_tag('table');
echo html_writer::end_tag('form');

//Placeholder cho danh muc mon hoc tuong ung voi tung khoi kien thuc
echo html_writer::tag('div', '', array('id'=>'txtSubjectList'));


/*------Ket thuc doan code cua ban-------*/


echo $OUTPUT->footer();

